home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / modula2f.zip / TEXT.DEF < prev    next >
Text File  |  1992-04-29  |  4KB  |  81 lines

  1. (* Text   BIOS I/O PROCEDURES   1992   Chris Harshman
  2.     This module of procedures was designed to be able to use Fitted Software
  3.     Tools Modula-2 Compiler to handle the screen with BIOS instead of DOS
  4.     routines.  This allows one to print to the screen in color, have more
  5.     control of the screen cursor, and use fast routines that take up less
  6.     space in your executable .EXE file.  Standard Modula-2 string format is
  7.     used.  Unlike routines from InOut, these routines cannot be redirected
  8.     through command line startup options or by the procedures in InOut designed
  9.     to redirect input or output.  NOTE: These routines do little error
  10.     checking, so be carefull what values are entered.  These routines should
  11.     not crash your program though.  Any user input should be checked by you
  12.     the programmer before sending it to these routines. *)
  13.  
  14. DEFINITION MODULE Text;
  15.  
  16. PROCEDURE Cls;
  17.      (* Clears the text screen.  Faster than Clear but doesn't work on
  18.         graphics screens.  Uses color set by last Color statement. *)
  19.  
  20. PROCEDURE Color(fgc,bgc:CARDINAL);
  21.     (* Sets color attribute for screen output.  The color range is 0-15 for
  22.      foreground color and 0-7 for background.  Must be called before using
  23.      any of the Read or Write routines. *)
  24.  
  25. PROCEDURE SetText;
  26.     (* Sets the screen to 80x25 text color mode. *)
  27.  
  28. PROCEDURE SetEgaText;
  29.     (* Sets the screen to 132x25 text color mode on EGA cards that support it *)
  30.  
  31. PROCEDURE SetEga43;
  32.     (* Sets the screen to 132x43 text color mode on EGA cards that support it *)
  33.  
  34. PROCEDURE SetCursor(v,h:CARDINAL);
  35.     (* Sets the cursor to verticle row (from 0 to 24), horizontal column
  36.        (from 0 to 79 or 131 depending on screen mode). *)
  37.  
  38.     (* All Read and Write routines will print in the colors specified by the
  39.        last Color statement *)
  40. PROCEDURE GetKey(VAR ch,scan:CHAR);
  41.     (* Waits for input from the keyboard.  Puts the standard ASCII character
  42.        in ch and the scan code character in scan. *)
  43.  
  44. PROCEDURE Read(VAR ch:CHAR);
  45.     (* Reads one character from the keyboard and outputs to screen using
  46.        the BIOS calls in GetKey and Write. *)
  47.  
  48.  
  49.     (* ReadCard and ReadInt will give unpredictable results if a number
  50.        outside the ranges of the type are entered. *)
  51. PROCEDURE ReadCard(VAR n:CARDINAL);
  52.     (* Reads a cardinal number from the keyboard. If a non-number character is
  53.        entered in the input, it is ignored. (ex enter a1, the a is ignored) *)
  54.  
  55. PROCEDURE ReadInt(VAR i:INTEGER);
  56.     (* Reads an integer number from the keyboard.  If a non-number character
  57.        besides a leading - is entered, it is ignored. *)
  58.  
  59. PROCEDURE ReadString(VAR str:ARRAY OF CHAR);
  60.     (* Reads str from the keyboard using BIOS calls. *)
  61.  
  62. PROCEDURE Write(ch:CHAR);
  63.     (* Writes ch directly to the screen in Color using BIOS calls. *)
  64.  
  65. PROCEDURE WriteCard(n,lngth:CARDINAL);
  66.     (* Writes n in a field of Length lngth.  lngth must be at least the length
  67.        of the number to be printed or the leftmost numbers will be cut off.
  68.        The length can be up to 10. *)
  69.  
  70. PROCEDURE WriteInt(n:INTEGER; lngth:CARDINAL);
  71.     (* Writes n in a field of Length lngth.  lngth must be at least the length
  72.        of the number to print or the leftmost numbers and/or sign are cut off.
  73.        The length can be up to 10. *)
  74.  
  75. PROCEDURE WriteString(str:ARRAY OF CHAR);
  76.     (* Writes str directly to screen in current Color using BIOS calls. *)
  77.  
  78. PROCEDURE WriteLn;
  79.     (* Does a carriage return and linefeed, puts cursor on begining of next line *)
  80.  
  81. END Text.